<template>
  <div class="wrapper">
    <!--表格-->
    <div>
      <Table border stripe :columns="columns" :data="data"></Table>
      <!--Vue组件-->
      <div class="page">
        <paging :all="all" @returnValue="returnValue"></paging>
      </div>
    </div>
  </div>
</template>

<script>
  import paging from '../module/paging.vue';

  export default {
    components: {paging},
    data() {
      return {
        /*分页*/
        all: 1,
        cur: 1,
        /*表格*/
        columns: [
          {
            title: '标题',
            key: 'title',
            align: 'center',
          },
          {
            title: '说明',
            key: 'particulars',
            align: 'center',
          },
          {
            title: '联系人',
            key: 'contact',
            align: 'center',
          },
          {
            title: '单位',
            key: 'firm',
            align: 'center',
          },
        ],
        data: [],
      }
    },
    mounted() {
      window.scrollTo(0, 0);
      this.get(this.$api.url + '/legal/list/page/', this.cur)
    },
    methods: {
      /*分页*/
      returnValue(data) {
        this.cur = data;
        this.get(this.$api.url + '/legal/list/page/', this.cur)
      },
      /*get请求*/
      get(url, cur) {
        this.$axios.get(url + cur).then((res) => {
          this.data = res.data.data.lists;
          this.all = res.data.data.totalPage;
        });
      },


    }
  }
</script>

<style scoped>
  .wrapper {
    margin: 10px;
  }
</style>
